---
apiVersion: v1
kind: Namespace
metadata:
  name: dragonfly-e2e

---
apiVersion: v1
kind: Service
metadata:
  name: file-server
  namespace: dragonfly-e2e
spec:
  selector:
    app: dragonfly
    component: file-server
  type: ClusterIP
  ports:
  - name: nginx
    port: 80
    protocol: TCP
    targetPort: 80

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: file-server
  namespace: dragonfly-e2e
spec:
  serviceName: file-server
  selector:
    matchLabels:
      app: dragonfly
      component: file-server
  replicas: 1
  template:
    metadata:
      labels:
        app: dragonfly
        component: file-server
    spec:
      containers:
      - name: nginx
        # Pull image with dragonfly
        image: d7y.io/library/nginx:1.21.1-alpine
        imagePullPolicy: "IfNotPresent"
        ports:
        - containerPort: 80
        volumeMounts:
        - name: files
          mountPath: /usr/share/nginx/html/kind
      volumes:
      - name: files
        hostPath:
          path: /

---
apiVersion: v1
kind: Service
metadata:
  name: file-server-no-content-length
  namespace: dragonfly-e2e
spec:
  selector:
    app: dragonfly
    component: file-server-no-content-length
  type: ClusterIP
  ports:
  - name: server
    port: 80
    protocol: TCP
    targetPort: 80

---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: file-server-no-content-length
  namespace: dragonfly-e2e
spec:
  serviceName: file-server-no-content-length
  selector:
    matchLabels:
      app: dragonfly
      component: file-server-no-content-length
  replicas: 1
  template:
    metadata:
      labels:
        app: dragonfly
        component: file-server-no-content-length
    spec:
      containers:
      - name: server
        image: d7yio/no-content-length:latest
        imagePullPolicy: "IfNotPresent"
        ports:
        - containerPort: 80
        volumeMounts:
        - name: files
          mountPath: /static/kind
      volumes:
      - name: files
        hostPath:
          path: /
